# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=tevent
pkgver=0.11.0
pkgrel=1
pkgdesc="The tevent library"
url="https://tevent.samba.org/"
arch="all"
license="LGPL-3.0-or-later"
makedepends="libtirpc-dev python3-dev talloc-dev cmocka-dev"
replaces="samba"
subpackages="$pkgname-dev py3-$pkgname:_py3"
source="https://samba.org/ftp/tevent/tevent-$pkgver.tar.gz
	fix-public-header.patch
	python-3.10.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--disable-rpath \
		--bundled-libraries=NONE \
		--without-gettext
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

_py3() {
	pkgdesc="Python 3 binding for the tevent library"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/python3* "$subpkgdir"/usr/lib/
}

sha512sums="
740346b19bf290ff31b0c1b36e232021b8ad107c3ce27e0e8b1ec1a77485214b07a9b7837ba57f3650a50e4c04f530674e486b5fa4d118a1778259be63b49790  tevent-0.11.0.tar.gz
ee4cce8591dfe31288975596d8464b7cc160580715f88e4fd19b5ae7e1a831650b072954731f015f52d76600597faee894f0174b9e92d18dca9629f9d056230c  fix-public-header.patch
8014ee4a58c4fdb432c93d999c102b6197d429a80be8553383d74e36d6d291862a64afa081ec17d1f45ae84a61bc0580f0f6eb969462839043828207d2235196  python-3.10.patch
"
